package basketball_behaviour

import (
	"longmen/server/internal/services/nami/services/sports/basketball"
	"longmen/server/pkg/db/mysql/models/models_sports"
)

type (
	CountryApiResponse struct {
		Code    int       `json:"code"`
		Results []Country `json:"results"`
	}
	Country struct {
		ID         int    `json:"id"`          // 国家id
		CategoryID int    `json:"category_id"` // 分类id
		NameZh     string `json:"name_zh"`     // 中文名称
		NameZht    string `json:"name_zht"`    // 粤语名称
		NameEn     string `json:"name_en"`     // 英文名称
		Logo       string `json:"logo"`        // 国家logo
		UpdatedAt  int    `json:"updated_at"`  // 更新时间
	}
)

func (r CountryApiResponse) Interface() []basketball.InsertCountryInterface {
	a := make([]basketball.InsertCountryInterface, 0)
	for _, record := range r.Results {
		a = append(a, record)
	}
	return a
}

func (c Country) Get() models_sports.BasketballCountry {
	return models_sports.BasketballCountry{
		ID:         c.ID,
		CategoryID: c.CategoryID,
		NameZh:     c.NameZh,
		NameZht:    c.NameZht,
		NameEn:     c.NameEn,
		Logo:       c.Logo,
		UpdatedAt:  c.UpdatedAt,
	}
}
